package com.gitee.algorithm.test;

import com.gitee.algorithm.linear.Stack;

public class DemoStack {
    public static void main(String[] args) {
        //创建栈对象
        Stack<String> stack=new Stack<>();
        //测试压栈
        stack.push("a");
        stack.push("b");
        stack.push("c");
        stack.push("d");
        for (String s:stack) {
            System.out.println(s);
        }
        System.out.println("-----------------");
        //测试弹栈
        String pop1 = stack.pop();
        System.out.println(pop1);
        for (String s:stack) {
            System.out.println(s);
        }
        /*
        d
        c
        b
        a
        -----------------
        d
        c
        b
        a
         */
    }
}
